/**
 * Copyright 2010 Mark Wyszomierski
 */
package jsonParser;

import json.Json_City;

import org.json.JSONException;
import org.json.JSONObject;

import com.ruiyi.baseparser.AbstractParser;


/**
 * @date July 13, 2010
 * @author Mark Wyszomierski (markww@gmail.com)
 *
 */
public class CityParser extends AbstractParser<Json_City> {
    private static final String TAG = "CityParser";

	@Override
    public Json_City parse(JSONObject json) throws JSONException {
        
        Json_City obj = new Json_City();
        if (json.has("id")) {
            obj.setId(json.getLong("id"));
        } 
        if (json.has("name")) {
            obj.setName(json.getString("name"));
        } 
        if (json.has("childnum")) {
            obj.setChildNums(json.getInt("childnum"));
        }
//        Log.e(TAG, obj.toString());
        return obj;
    }
}